<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        console.log('欢迎使用农行ATM');

        var password = ''
        var errorCount = 0
        var isSuccess = false
        do {
            password = prompt('请输入密码：')
            isSuccess = password === '123456' //比对密码
            //密码错误给出提示
            if (isSuccess === false) {
                console.log('密码不正确，请重新输入！');
                errorCount++
                //错误次数到了3次则退出
                if (errorCount === 3) {
                    console.log('连续错误三次，卡已冻结');
                    break //打断循环
                }
            }

        } while (isSuccess === false);

        if (isSuccess) {
            errorCount = 0 //登录成功则把错误记录清空
            console.log('请选择操作，1.查询  2.取款   3.存款');
        } else
            console.log('登录失败！');

        
    </script>
</body>

</html>